// pages/mv/mv.js
const {http} = require('../../utils/http')
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var url = `http://47.108.197.28:3000/mv/first`;
        http({
            url,
            success:res=>{
                this.handleHttpData(res);
            }
        })
    },
    handleHttpData(result) {
        var res = result.data.data;
        var arr = [];
        res.forEach(item => {
            var { id,name, cover } = item;
            arr.push({
                id,
                name,
                cover
            })
        })
        // console.log(arr);
        this.setData({
            arr
        })
    },
    clickItem(e){
        var {aid} = e.currentTarget.dataset;
        var url = `/pages/detail/detail?id=${aid}`
        wx.navigateTo({
            url,
        });
    }
})